package cupk.abner;

public class ConcreteAllyControlCenter extends AllyControlCenter{
    @Override
    public void setAllyName(String allyName) {
        this.allyName = allyName;
    }

    @Override
    public String getAllyName() {
        return this.allyName;
    }

    @Override
    public void join(Observer obs) {
        players.add(obs);
        System.out.println(obs.getName()+"加入"+this.allyName+"战队！");
    }

    @Override
    public void quit(Observer obs) {
        players.remove(obs);
        System.out.println(obs.getName()+"退出"+this.allyName+"战队！");
    }

    @Override
    public void notifyObserver(String name) {
        for(Observer obs : players){
            if(!((Observer)obs).getName().equalsIgnoreCase(name)){
                ((Observer)obs).help();
            }
        }
    }
}